import java.lang.Math;
public class Complex {
	
	
	/**
	 * Konstruktor
	 */
	public Complex(double real,double imag)
	{
		this.real = real;
		this.imag = imag;
	}
	
	/**
	 * Setter Methoden
	 *
	 */
	public void setReal(double real)
	{
		this.real = real;
	}
	public void setImag(double imag)
	{
		this.imag = imag;
	}
	/**
	 * Getter Methoden
	 */
	
	public double getReal()
	{
		return real;
	}
	
	public double getImag()
	{
		return imag;
	}
	
	
	/**
	 * Addieren
	 * @param complex mit getter
	 */
	public void add(Complex complex)
	{
		real=this.getReal() + complex.getReal();
		imag=this.getImag() + complex.getImag();
	}
	/**
	 * Subtrahieren mit getter
	 * @param complex
	 */
	public void subtract(Complex complex)
	{
		real= this.getReal() - complex.getReal();
		imag= this.getImag() - complex.getImag();
		
	}
	/**
	 * Multiplizieren
	 * @param complex
	 * @return 
	 */
	public Complex multiply(Complex complex)
	{
       double a = this.real * complex.real - this.imag * complex.imag;
       double b = this.real * complex.imag + this.imag * complex.real;
       return new Complex(a,b);
		
	}
	public Complex divide(Complex complex)
	{
		double a = (this.real*complex.real+this.imag*complex.imag)/(Math.pow(complex.real,2)+Math.pow(complex.imag,2));
		double b = (this.imag*complex.real-this.real*complex.imag)/(Math.pow(complex.real,2)+Math.pow(complex.imag,2));
		return new Complex(a,b);
	}
	
	
	/**
	 * Variablen
	 */
	private double real = 0;
	private double imag = 0;
	


}
